<template>
	<view class="p-page types">
		<view :class="cur==1?'type-warp cur-type':'type-warp' " @click="setType(1)">
			<view class="type type1"> </view> 
			<view class="type-text"> 高层 </view>
		</view>
		<view :class="cur==2?'type-warp cur-type':'type-warp' " @click="setType(2)">
			<view class="type type2"> </view> 
			<view class="type-text"> 公寓 </view>
		</view>

		<view :class="cur==3?'type-warp cur-type':'type-warp' " @click="setType(3)">
			<view class="type type3"> </view> 
			<view class="type-text"> 别墅 </view>
			
		</view>
		<view :class="cur==4?'type-warp cur-type':'type-warp' " @click="setType(4)">
			<view class="type type4"> </view> 
			<view class="type-text"> 单家 </view>
			
		</view>
        
        <view :class="cur==7?'type-warp cur-type':'type-warp' " @click="setType(7)" v-if="render('dipi')">
        	<view class="type type7"> </view>
        	<view class="type-text"> 地皮 </view>
        </view>
		<view :class="cur==5?'type-warp cur-type':'type-warp' " @click="setType(5)">
			<view class="type type5"> </view>
			<view class="type-text"> 写字楼 </view>
		</view>
		<view :class="cur==6?'type-warp cur-type':'type-warp' " @click="setType(6)">
			<view class="type type6"> </view> 
			<view class="type-text"> 商铺 </view>
			
		</view>
	</view>
</template>
<script>
	export default {
		components: {},
		data() {
			return {
				cur: 1,
			};
		},
		created() {
			var publishInfo = this.$store.state.publishInfo
			console.log(publishInfo);
			this.cur = publishInfo.propertyType
		},
		mounted() {
			
		},
		methods: {
			setType(index) {
				console.log(index);
				this.cur = index;
				this.$store.dispatch("asyncPublishInfo", { propertyType: index,type: index, });
			},
		},
	};
</script>

<style lang="scss">
	.types {
		display: flex;
		flex-wrap: wrap;
		color: #fff;
		font-size: 12px;
		align-content:baseline;
		.type-warp {
			background: #ccc;
			border-radius: 10px;
			width: 90px;
			height: 90px;
			margin: 10px 30px 0px 0px;
			display: flex;
			flex-direction: column;
			align-items: center;
			padding: 20px 0 0 0;
		}

		.cur-type {
			background: #FFD851
		}

		.type {
			width: 40px;
			height: 40px;
		}
		.type-text{
			margin-top: 5px;
		}

		.type1 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t4.png)center center / 100% 100%;
		}

		.type2 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t5.png) center center / 100% 100%;
			
		}

		.type3 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t1.png) center center / 100% 100%;
		}

		.type4 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t2.png) center center / 100% 100%;
		}

		.type5 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t7.png) center center / 100% 100%;
		}

		.type6 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t6.png) center center / 100% 100%;
		}
		.type7 {
			background: url(http://house-detective.oss-cn-guangzhou.aliyuncs.com/t3.png) center center / 100% 100%;
		}
	}
</style>
